from pyparsing import *
import string



printables = string.printable
printables = printables[:63]+printables[64:68]+printables[69:93] #without ",'

DebugPrint = CaselessKeyword("print").suppress()+Literal("(").suppress()+quotedString+ Literal(")").suppress()
def printParseAction(s,loc,toks):
    print toks[0][1:-1]
DebugPrint.setParseAction(printParseAction)

CommentText = ZeroOrMore(Word(alphanums))
Comment = Literal("//").suppress() + CommentText.suppress()

commentTest = """ // comment! """

printTest = """PRINT ( " hey's great" )"""

DebugLine = DebugPrint #|Comment

if __name__=='__main__':
    test = printTest
    header = 'Parser Tester begins:\n'
    print header + '=' * (len(header)-1)
    print test
    print '-' * (len(header)-1) + '\n'
    try:
        results = DebugLine.parseString(test)
        print '-' * (len(header)-1)
        print results
    except ParseException, pe:
        print pe
